import { Outlet, createHashRouter } from "react-router-dom"
import Header from "../views/Header/Header";
import Home from "../views/Home/Home";
import About from "../views/About/About";
import Advanced from "../views/Advanced/Advanced";
import Concepts from "../views/Concepts/Concepts";
import Error404 from "../views/Error/Error404";
import Login from "../views/Login/Login";

// 布局组件
const Layout = () => (
    <div className="layout">
        <Header />
        <main className="main-content">
            <Outlet />
        </main>
    </div>
);

const router = createHashRouter(
    [
        {
            path: '/',
            element: <Layout />,
            children: [
                { path: '', element: <Home /> },
                { path: 'concepts', element: <Concepts /> },
                { path: 'about', element: <About /> },
                { path: 'advanced', element: <Advanced /> },
            ]
        },
        {
            path: '/login',
            element: <Login></Login>
        },
        {
            path: '*',
            element: <Error404></Error404>
        }
    ],
);

export default router;  